<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>Finalove-App-nearBy</title>
		<link rel="stylesheet" href="../../resource/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="../../resource/css/mint.css">
		<link rel="stylesheet" href="../../resource/css/style.css">
		<script src="../../resource/js/vue.js"></script>
		<script src="../../resource/js/mint.min.js"></script>
		<script src="../../resource/js/jquery.min.js"></script>
		<style type="text/css">
			#main{
				background: #F0F0F0;
			}
			.ct-box {
				margin-top: 140px;
			}
			.QRcode-card {
				padding: 30px;
				background-color: #FFF;
				width: 200px;
				margin: 0 auto;
				border-radius: 15px;
				border: 2px solid #ebeef5;
				box-shadow: 0 4px 12px 0 rgba(0,0,0,0.1);
			}
			.QRcode-remark {
				color: #606266;
			}
		</style>
	</head>
	<body>
		<div id="main">
			<mt-header fixed title="我的二维码名片">
				<mt-button icon="back" slot="left" @click="closeView"></mt-button>
			</mt-header>
			<div class="ct-box">
				<div class="QRcode-card">
					<div id="outputQRcode"></div>
					<p class="text-center QRcode-remark">
						扫一扫二维码，加我为好友
					</p>
				</div>
			</div>
		</div>
	</body>
	<script src="../../resource/js/utf.js"></script>
	<script src="../../resource/js/jquery.qrcode.js"></script>
	<script type="text/javascript">
		var main = new Vue({
			el:"#main",
			data:{
				userInfo:{
					user_head:""
				},
			},
			mounted:function() {
				this.init();
			},
			methods:{
				init() {
					document.addEventListener('plusready',function () {
						plus.navigator.setFullscreen(true);
						plus.key.addEventListener('backbutton', function() {
							plus.webview.currentWebview().close();
							return false;
						}, false);
						// 获取信息
						main.userInfo = {
							user_id:plus.storage.getItem("user_id"),
							user_head:plus.storage.getItem("user_head"),
						}
						main.mkQRcode();
					});
				},
				closeView() {
					plus.webview.currentWebview().close();
				},
				mkQRcode() {
					var url = "https://www.finalove.top/index/index/applyByQRcode?to_id="+this.userInfo.user_id;
					$('#outputQRcode').qrcode({
						render:"canvas",
						text:url,
						width:"200",
						height:"200",
						background:"#FFF",
						foreground:"#409EFF",
						src:main.userInfo.user_head
					});
				},
			}
		})
	</script>
</html>
